home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-01 / ov143b.zip / OV.H < prev    next >
C/C++ Source or Header  |  1993-01-04  |  9KB  |  236 lines

  1. /*  043  31-May-87  ov.h
  2.  
  3.         Copyright (c) 1987 by Blue Sky Software.  All rights reserved.
  4. */
  5.  
  6. #ifndef TRUE
  7. #define TRUE (1)
  8. #define FALSE (0)
  9. #endif
  10.  
  11. #ifndef NULL
  12. #define NULL (0)
  13. #endif
  14.  
  15. #define SCREEN_COLS (80)
  16. #define SCREEN_ROWS (25)
  17.  
  18. /* file name display constants */
  19.  
  20. #define VOL_ROW (1)
  21. #define FILE_STAT_ROW (VOL_ROW+2)
  22. #define TAG_STAT_ROW (FILE_STAT_ROW+1)
  23. #define MASK_ROW (VOL_ROW+2)
  24. #define UP_BOUND (TAG_STAT_ROW+1)
  25. #define FIRST_NROW (UP_BOUND+1)
  26. #define NAME_ROWS (STATUS_ROW-FIRST_NROW)
  27. #define STATUS_ROW (MENU_ROW - 1)
  28. #define MENU_ROW (PROMPT_ROW - 1)
  29. #define PROMPT_ROW (SCREEN_ROWS - 1)
  30.  
  31. #define PATH_COL (13)
  32. #define VOL_STAT_COL (2)
  33. #define NUM_FILES_COL (31)
  34. #define SPACE_USED_COL (44)
  35. #define MASK_COL (69)
  36.  
  37. /* view display constants */
  38.  
  39. #define FIRST_VROW (1)
  40. #define VIEW_ROWS (STATUS_ROW-FIRST_VROW)
  41.  
  42. /* help display constants */
  43.  
  44. #define FIRST_HROW (1)
  45. #define HELP_ROWS (STATUS_ROW-FIRST_VROW)
  46.  
  47. /* configuration parameters */
  48.  
  49. #define MAX_REPLY (SCREEN_COLS-4)      /* max user reply length to prompt */
  50. #define MAX_DIR 256                    /* max # dir's processed */
  51. #define MAX_FILES 1000                 /* max # files processed in files[] */
  52. #define MAX_PATHLEN 65                 /* max dir pathname length */
  53. #define MAX_VOLLEN 11                  /* max volume label length */
  54. #define MAX_NAMELEN 12                 /* max length of file name */
  55. #define MASK_LEN 10                    /* max len of file selection mask */
  56. #define MAX_DRIVES 20                  /* max drives we will handle */
  57.  
  58. /* display attributes for text types */
  59.  
  60. #define DIS_NORM 0             /* normal display */
  61. #define DIS_HIGH 1             /* highlighted display (current file) */
  62. #define DIS_BOX  2             /* dialog box display */
  63. #define DIS_HIBOX 3            /* highlight in dialog box */
  64. #define DIS_HEAD 4             /* header text */
  65. #define DIS_TEXT 5             /* static text display */
  66. #define DIS_TAGD 6             /* tagged display */
  67.  
  68. /* keyboard mapping */
  69.  
  70. #define LEFT 128               /* left arrow */
  71. #define RIGHT 129              /* right arrow */
  72. #define UP 130                 /* up arrow */
  73. #define DOWN 131               /* down arrow */
  74. #define PGUP 132               /* page up */
  75. #define PGDN 133               /* page dn */
  76. #define HOME 134               /* home */
  77. #define END 135                /* end */
  78. #define TAG 136                /* tag the current file toggle */
  79. #define HELP 137               /* Help via function key */
  80. #define OPENW 138              /* open file display window */
  81. #define CLOSEW 139             /* close file display window */
  82. #define NEXTW 140              /* goto next file display window */
  83. #define PREVW 141              /* goto prev file display window */
  84. #define INS 142                /* insert toggle key */
  85. #define DEL 143                /* delete char key */
  86. #define GOPAR 144              /* goto parent directory */
  87. #define GOSUB 145              /* goto subdirectory */
  88. #define NEXTT 146              /* goto next tagged file */
  89. #define PREVT 147              /* goto prev taggd file */
  90. #define RUBOUT 8               /* rubout last char key */
  91. #define RETURN 13              /* return key */
  92. #define EOF_CH (0x1A)          /* eof character which will quit overview */
  93. #define ESC_KEY (0x1b)         /* escape char */
  94.  
  95. #define NUM_UDK 10                             /* 10 UDK keys */
  96. #define UDK_START 148                          /* first UDK key */
  97. #define UDK_END (UDK_START + NUM_UDK - 1)      /* last UDK key */
  98.  
  99. /* file attribute flags */
  100.  
  101. #define TAGGED  (128)          /* file has been tagged */
  102. #define ARCHIVE (32)           /* file modified since backup */
  103. #define DIR     (16)           /* file is a subdirectory */
  104. #define SYSTEM  (4)            /* system file */
  105. #define HIDDEN  (2)            /* hidden file */
  106. #define RDONLY  (1)            /* file is read only */
  107.  
  108. /* Window update flags */
  109.  
  110. #define W_PACK (1)             /* pack the files before redisplay */
  111. #define W_DISP (2)             /* just redisplay */
  112.  
  113.  
  114. /* internal drive entry structure */
  115.  
  116. typedef struct drive_ent {
  117.    struct drive_ent *next;             /* pointer to next DRIVE_ENT in list */
  118.    int drive;                          /* drive letter, 'A' - ? */
  119.    unsigned int clustersiz;            /* size of a cluster on volume */
  120.    unsigned long vol_size;             /* size of volume */
  121.    unsigned long vol_free;             /* free space on volume */
  122.    char volbuf[MAX_VOLLEN+1];          /* current volume name buffer */
  123. } DRIVE_ENT;
  124.  
  125. /* internal file entry structure */
  126.  
  127. typedef struct file_ent {
  128.    char name[MAX_NAMELEN+1];           /* the file name */
  129.    unsigned char flags;                /* flags for this file */
  130.    unsigned index;                     /* sequential index number */
  131.    unsigned date;                      /* date last modified */
  132.    unsigned time;                      /* time last modified */
  133.    char *dirp;                         /* ptr to dir name for file if showall */
  134.    long size;                          /* file size in bytes or blocks */
  135. } FILE_ENT;
  136.  
  137. /* window structure */
  138.  
  139. typedef struct window {
  140.    struct window *next;                /* ptr to next winwow in list */
  141.    struct window *prev;                /* ptr to prev window in list */
  142.  
  143.    int curidx;                         /* current files[] index */
  144.  
  145.    int fwrow;                          /* first window display row */
  146.    int wrows;                          /* # window display rows */
  147.    int fnrow;                          /* first name display row */
  148.    int ndrows;                         /* # name display rows */
  149.  
  150.    int maxlen;                         /* size of the largest file name */
  151.    int colsiz;                         /* size of a name column in chars */
  152.  
  153.    int ncols;                          /* number of logical columns on screen */
  154.    int nrows;                          /* number of logical rows used 4 files */
  155.    int nbase;                          /* files[] idx of first name displayed */
  156.    int nfiles;                         /* number entries in files[] */
  157.  
  158.    int updated;                        /* NZ if window needs redisplay */
  159.  
  160.    DRIVE_ENT *drivep;                  /* pointer to DRIVE_ENT for window */
  161.  
  162.    unsigned int num_files;             /* number files selected in directory */
  163.    unsigned int num_tagged;            /* number of files tagged */
  164.    unsigned long tag_size;             /* size of tagged files */
  165.    unsigned long files_size;           /* # bytes used by files */
  166.  
  167.    char far *save_files;               /* ptr to files[] data for window */
  168.  
  169.    int sortopt;                        /* window sort option */
  170.    int (*sortfunc)();                  /* pointer to sorting function */
  171.  
  172.    unsigned char info_display;         /* NZ when exteneded file info shown */
  173.    unsigned char showall;              /* NZ when showall mode active */
  174.  
  175.    unsigned char selatrs;              /* selection attribute flags */
  176.    unsigned char maskcmp;              /* include/exclude meaning of mask */
  177.    char mask[MASK_LEN+1];              /* current file selection mask */
  178.  
  179.    char dirbuf[MAX_PATHLEN+1];         /* current dir name buffer */
  180. } WINDOW;
  181.  
  182. /* Point-and-Go table entry */
  183.  
  184. typedef struct {
  185.    char ext[4];
  186.    char cmd[41];
  187.    unsigned char used;
  188.    unsigned char pause;
  189.    unsigned char reload;
  190. } PAG_ENT;
  191.  
  192. #define NUM_PAG (10)                   /* 10 Point-and-Go entries */
  193.  
  194. /* User Defined Key table entry */
  195.  
  196. typedef struct {
  197.    char cmd[41];
  198.    unsigned char used;
  199.    unsigned char pause;
  200.    unsigned char reload;
  201. } UDK_ENT;
  202.  
  203. /* misc macros to translate coordinates */
  204.  
  205. #define min(a,b) ((a < b) ? a : b)             /* min of two values */
  206. #define yes(c) (c == 'Y' || c == 'y')          /* is char == Yy? */
  207.  
  208. #define lr2sr(r) (cw.fnrow + (r - cw.nbase))   /* logical row to screen row */
  209. #define lc2sc(c) (c * cw.colsiz)               /* logical col to screen col */
  210. #define idx2lr(i) (i % cw.nrows)               /* idx to logical row */
  211. #define idx2lc(i) (i / cw.nrows)               /* idx to logical col */
  212. #define idx2sr(i) (lr2sr(idx2lr(i)))           /* idx to screen row */
  213. #define idx2sc(i) (lc2sc(idx2lc(i)))           /* idx to screen col */
  214.  
  215. /* function declaration stuff */
  216.  
  217. #define ALTCALL pascal         /* alternate calling method reduces overhead */
  218.  
  219. void ALTCALL disp_file(FILE_ENT *, int);       /* common func declarations */
  220. void ALTCALL disp_vol_stats(void);
  221. void ALTCALL disp_file_stats(void);
  222. int ALTCALL adjust_window(void);
  223. int ALTCALL update_window(int);
  224. int ALTCALL on_screen(int);
  225. int ALTCALL fp_on(int);
  226. int ALTCALL fp_off(int);
  227. char * ALTCALL prompt(char *, char *, char *, int, int);
  228. char * ALTCALL read_str(int, char *, int);
  229. char * ALTCALL fname(FILE_ENT *);
  230.  
  231. #ifdef LINT_ARGS       /* include common function declarations if wanted */
  232. #include <io.h>
  233. #include <malloc.h>
  234. #include <string.h>
  235. #endif
  236.